package com.allwees.bs.module.ops.req;

import com.allwees.bs.core.model.ops.AdsModel;
import com.allwees.core.common.util.reflect.PojoUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * @Author Daniel
 * @Version 1.0.0
 * @Description
 * @CreateTime 2020/10/16 14:44
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class AdEditDTO extends AdDTO {
    private static final long serialVersionUID = -156435674155156593L;

    @NotNull(groups = {Edit.class})
    private Integer id;

    @NotEmpty(groups = {Add.class})
    private String imgUrl;

    private String forwardUrl;

    private Integer sort;

    private String param;

    public AdsModel toEntity(){
        AdsModel model = new AdsModel();
        PojoUtil.copy(model, this);
        return model;
    }
}
